/*
 * Random.h
 *
 *  Created on: 2009-5-17
 *      Author: thh
 */

#ifndef RANDOM_H_20090517
#define RANDOM_H_20090517

#include <openssl/rand.h>

namespace Ybdj {

namespace Crypt {

class Random {
private:
	Random();
	virtual ~Random();
public:
	static const RAND_METHOD *getMethod();
	static const RAND_METHOD *getBuiltIn();
	static void setMethod(const RAND_METHOD *method);
	static void setMethod(ENGINE *engine);
	static void Clean();
	static void Seed(const void *buf, int num);
	static void Seed(const void *buf, int num, double entropy);
	static bool Status();
	static bool Generate(unsigned char *buf,int num);
	static bool GeneratePseudo(unsigned char *buf,int num);
	static const char *Path(char *path, long num);
	static int SeedRead(const char *filename, long max_bytes=-1);
	static int SeedWrite(const char *filename);
};

}

}

#endif /* RANDOM_H_20090517 */
